---
title: "Apply Requirements"
---

Digger supports apply_requirements on the project level to enforce certain conditions are met before an apply action occurs.

The following apply conditions are supported:

```
projects:
   - name: dev
     dir: dev
     apply_requirements: []
  - name: prod
    dir: prod
    apply_requirements: [mergeable, undiverged, approved]
```

Digger supports *mergeable*, *undiverged* and *approved* conditions. The default value for apply_requirements is [mergeable] if not set.
Here is an explanation of each:

## Mergeable

The mergeable requirement will prevent applies unless a pull request is able to be merged.
In GitHub, if you're not using Protected Branches then all pull requests are mergeable unless there is a conflict.

<Note>
    There is a [known issue](https://github.com/diggerhq/digger/issues/1180) that would
    cause the "mergability" check to conflict if you set the digger/apply check as required on github. We are working on a fix and in the meantime you have an option to turn off the mergability check if you want to have this digger/apply check as required. You can turn it off in the workflow configuration
    by setting the `skip_merge_check` flag as follows (we have to set the other configurations since they are currently required):

</Note>

### Usage

You can enable the mergeable requirement on the project level:

```
projects:
   - name: dev
     dir: dev
     apply_requirements: [mergeable]
```

Note that it is set by default so it would be enforced even if you don't specify it.

## Approved
The approved requirement will prevent applies unless the pull request is approved by at least one person other than the author.

### Usage

You can enable the approved requirement on the project level:

```
projects:
   - name: dev
     dir: dev
     apply_requirements: [approved]
```

## Undiverged

While PR locks prevent you from PRs stepping on eachother in parallel, they still do not protect you from a stale branch
that is behind the current main head. The undiverged requirement helps enforce this by preventing applies if there are any changes on the base branch
since the PR was opened. It can be resolved by merging main into the PR branch or rebasing the PR branch on top of main. In the case of github this is done by querying the comparecommits api on github side.

### Usage

You can enable the undiverged requirement on the project level:

```
projects:
   - name: dev
     dir: dev
     apply_requirements: [undiverged]
```

## Skipping mergeability check

The default behaviour of digger is to perform a mergeability check before applying a PR. In order to skip the
mergeability check you can specify an empty list of apply requirements on the project level

```
projects:
  - name: dev
    dir: dev
    apply_requirements: []
```

Alternatively, you can also skip the mergeability check on the workflow level:

```
projects:
- name: dev
  dir: dev
  workflow: mydev

workflows:
  mydev:
    workflow_configuration:
      on_pull_request_pushed: ["digger plan"]
      on_pull_request_closed: ["digger unlock"]
      on_commit_to_default: ["digger unlock"]
      skip_merge_check: true
```
